<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>今博士_爱的DIY</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title></title>
	<link rel="stylesheet" href="__CSS__/chao/reset.css" />
	<link rel="stylesheet" href="__CSS__/chao/amazeui.min.css" />
	<link rel="stylesheet" href="__CSS__/chao/public.css" />
	<link rel="stylesheet" href="__CSS__/chao/div.css" />
	 <link rel="Stylesheet" type="text/css" href="__CSS__/dialogbyshf.css" />
	 	<style>
		#DialogBySHF #Title{
	    background: #4CB3FB;
	    border-top-left-radius: 10px;
	    border-top-right-radius: 10px;
		}
		#DialogBySHF {
	    border-radius: 10px;
		}
	</style>
</head>
<body>
	<header>
		<div class="back1"><a href="<{:U('Personal/indexs')}>"><img src="__IMG__/chao/back.png"></a></div>
		<div class="tit">爱的DIV</div>
		<div class="bianji">清空</div>
	</header>
	<ul class="main">
		<li class="div0 div1">
			<div class="div00 div11"><img src="__IMG__/chao/media.png"></div>
			<div>添加视频<{$_SESSION['old_video']}></div>
		</li>
		<li class="div0 div2">
			<div class="div00 div21"><img src="__IMG__/chao/picture.png"></div>
			<div>添加图片<{$_SESSION['old_img']}></div>
		</li>
		<li class="div0 div3">
			<div class="div00 div31"><img src="__IMG__/chao/text.png"></div>
			<div>添加文字<{$_SESSION['text']}></div>
		</li>
	</ul>
	<form class="main11 submit0">
		<a href="javascript:set();">提交</a>
	</form>

	<!-- <ul class="div-tj">
		<li class="tj">
			<div class="tj-t">
				<span></span>
				<span class="span11">添加视频</span>
				<span class="tj-del">×</span>
			</div>
			<form class="tj-m">
				<div class="xqwj">选取文件<input type="file" name=""></div>
				<div class="tj-tp"><img src="__IMG__/chao/bf.png"></div>
				<div class="queding">
					<input type="submit" name="" value="确定">
				</div>
			</form>
			<div class="sc-succ">
				<div><img src="__IMG__/chao/success.png">视频上传成功！</div>
				<div class="wait">页面自动跳转等待时间：3</div>
			</div>
			<div class="sc-fail">
				<div><img src="__IMG__/chao/fail.png">视频上传失败！</div>
				<div>您上传的文件过大，请调整后再次上传</div>
				<div class="wait">页面自动跳转等待时间：3</div>
			</div>
		</li>
		<li class="tj">
			<div class="tj-t">
				<span></span>
				<span class="span11">添加图片</span>
				<span class="tj-del">×</span>
			</div>
			<form class="tj-m">
				<div class="xqwj">选取文件<input type="file" name=""></div>
				<div class="tj-tp"><img src="__IMG__/chao/bf.png"></div>
				<div class="queding">
					<input type="submit" name="" value="确定">
				</div>
			</form>
			<div class="sc-succ">
				<div><img src="__IMG__/chao/success.png">图片上传成功！</div>
				<div class="wait">页面自动跳转等待时间：3</div>
			</div>
			<div class="sc-fail">
				<div><img src="__IMG__/chao/fail.png">图片上传失败！</div>
				<div>您上传的文件过大，请调整后再次上传</div>
				<div class="wait">页面自动跳转等待时间：3</div>
			</div>
		</li>
		<li class="tj">
			<div class="tj-t">
				<span></span>
				<span class="span11">添加文字</span>
				<span class="tj-del">×</span>
			</div>
			<form class="tj-m">
				<div class="tjwz">
					<textarea></textarea>
				</div>			
				<div class="queding">
					<input type="submit" name="" value="确定">
				</div>
			</form>
			<div class="sc-succ">
				<div><img src="__IMG__/chao/success.png">文字上传成功！</div>
				<div class="wait">页面自动跳转等待时间：3</div>
			</div>
			<div class="sc-fail">
				<div><img src="__IMG__/chao/fail.png">文字上传失败！</div>
				<div>您上传的文件过大，请调整后再次上传</div>
				<div class="wait">页面自动跳转等待时间：3</div>
			</div>
		</li>
	</ul>	 -->





	<script src="__JS__/chao/jquery.min.js"></script>
	<script src="__JS__/chao/amazeui.min.js"></script>
	<script src="__JS__/chao/rem.js"></script>
	<script src="__JS__/chao/div.js"></script>
	<script type="text/javascript" src="__JS__/dialogbyshf.js"></script>
	<script>
$(document).ready(function () {
  // 添加视频
  $(".div1").click(function () {
    $.DialogBySHF.Alert({ Width: 240, Height: 120, Title: "添加视频", Content: '<form id="form2" method="post" enctype="multipart/form-data"><input type="file" name="video" style="width:100%;font-size:16px;margin-top:10px;" /><input type="submit" value="确定" onclick="uploadvideo()" style="margin-left:0px;width:100%;background: #C0E5FF;color: #0F73B9;font-size:16px;"/></form>', });
  });

  // 添加图片
  $(".div2").click(function () {
    $.DialogBySHF.Alert({ Width: 240, Height: 120, Title: "添加图片", Content: '<form id="form3" method="post" enctype="multipart/form-data"><input type="file" name="image"  style="width:100%;font-size:16px;margin-top:10px;" /><input type="submit" value="确定" onclick="uploadpic()" style="margin-left:0px;width:100%;background: #C0E5FF;color: #0F73B9;font-size:16px;"/></form>', });
  });
  //添加文字
  $(".div3").click(function () {
    $.DialogBySHF.Alert({ Width: 240, Height: 155, Title: "添加文字", Content: '<form id="form1" method="post"><textarea name="text" rows="2" cols="20" tyle="font-size:16px;height:3rem;width:100%;"></textarea><input type="submit" value="确定" onclick="uploadtext()" style="margin-top:15px;margin-left:0px;width:100%;background: #C0E5FF;color: #0F73B9;font-size:16px;"/></form>', });
  });
});

// 上传文字
function uploadtext(){
  var formData1 = new FormData($( "#form1" )[0]); 
  $.ajax({  
    url: "<{:U('Personal/add_txt')}>" ,  
    type: 'POST',  
    data: formData1,  
    async: true, 
    cache: false,  
    contentType: false,  
    processData: false,  
    success: function (e) {  
      console.log(e.msg);  
    },  
    error: function (e) {  
      alert(e.msg);  
    }  
  });  
}

// 上传视频
function uploadvideo(){
  var formData2 = new FormData($("#form2" )[0]);

  $.ajax({  
    url: "<{:U('Personal/add_video')}>" ,  
    type: 'POST',  
    data: formData2,  
    async: true,  
    cache: false,  
    contentType: false,  
    processData: false,
    beforeSend: function () {
      $("body").append('<div id="pload" style="position:fixed;top:30%;z-index:1200;background:url(__IMG__/statusss.gif) top center no-repeat;width:100%;height:140px;margin:auto auto;"></div>');
    },
    complete: function () {
      $("#pload").remove();
    },   
    success: function (e) {  
      console.log(e.msg);  
    },  
    error: function (e) {  
      alert(e.msg);  
    }  
  });  
}



// 上传图片
function uploadpic(){
    var formData3 = new FormData($("#form3" )[0]);
    $.ajax({  
      url: "<{:U('Personal/add_pic')}>" ,  
      type: 'POST',  
      data: formData3,  
      async: true, 
      cache: false,  
      contentType: false,  
      processData: false,  
      beforeSend: function () {
        $("body").append('<div id="pload" style="position:fixed;top:30%;z-index:1200;background:url(__IMG__/statusss.gif) top center no-repeat;width:100%;height:140px;margin:auto auto;"></div>');
      },
      complete: function () {
        $("#pload").remove();
      },  
      success: function (e) {  
        console.log(e.msg);  
      },  
      error: function (e) {  
        alert(e.msg);  
      }  
    });  
}

// 上传diy
function set(){
  var url = "<{:U('Personal/set')}>";
  var url2 = "<{:U('Personal/indexs',array('name'=>$name))}>";
  $.post(url,function(e){
    if(e.status ==1){
      // window.location.href=url2; 
    }else{
      alert(e.msg);
    }
  });
}

$('.bianji').click(function(){
	var url = "<{:U('Personal/clear')}>";
	$.post(url,function(e){
		if(e.status ==1){
			window.location.reload();
		}
	});
});
	</script>
</body>
</html>